package com.gigi.controller;

import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.Response;
import com.gigi.model.ClassDO;
import com.gigi.model.CourseDO;
import com.gigi.model.ListClassRequest;
import com.gigi.service.manual.ClassManageService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * 班级管理
 */
@RestController
@RequestMapping("class-manage")
public class ClassManageController {

    private final ClassManageService classManageService;

    public ClassManageController(ClassManageService classManageService) {
        this.classManageService = classManageService;
    }

    @ApiOperation(value = "保存")
    @PostMapping("/save")
    public Response save(@RequestBody @Valid ClassDO request) {
        return classManageService.save(request);
    }

    @ApiOperation(value = "列表")
    @PostMapping("/list")
    public MultiResponse<ClassDO> list(@RequestBody ListClassRequest request) {
        return classManageService.list(request);
    }

}
